﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LexLib.LexemNameSpace;

namespace LexLib.LexemNameSpace
{
    public class Lexem
    {
        public int beginIndex;
        public int endIndex;
        private ILexemType typeOfLexem;
        //private string text;

        //public string Text 
        //{
        //    get {return text;}
        //}
        public ILexemType TypeOfLexem
        {
            get { return typeOfLexem; }
        }

        public int BeginIndex
        {
            get { return beginIndex; }
        }

        public int EndIndex
        {
            get { return endIndex; }
        }

        public Lexem(ILexemType lexType,int beginInd, int endInd)
        {
            if ((lexType is SyntaxType)||(lexType is Modificator)||(lexType is CloseNormalBracketType)||(lexType is OpenNormalBracketType)
                || (lexType is OpenFigureBracketType) || (lexType is EndOfLineType) || (lexType is ProgramType) || (lexType is ConstBool) || (lexType is CloseFigureBracketType)||(lexType is BoolType)||(lexType is IntType)||(lexType is For)||(lexType is ConditionType))
            { endInd--; }
            if (lexType is ConstString) { endInd++; }
            typeOfLexem = lexType;
            beginIndex = beginInd;
            endIndex = endInd;
        }
    }
}
